package com.sinacom.ibuilding.dao.impl;

import java.util.List;
import java.util.Map;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;
import com.sinacom.ibuilding.beans.Member;
import com.sinacom.ibuilding.beans.Role;
import com.sinacom.ibuilding.dao.iface.MemberDao;

public class MemberDaoImpl extends SqlMapDaoTemplate implements MemberDao{
	
	public MemberDaoImpl(DaoManager daoManager){
		super(daoManager);
	}
	
	

	public List getMemberList(Map map) {
	    return queryForList("getMemberList", map);
    }
	
	
	
	public List getCatgoryMember(Map map) {
		return queryForList("getCatgoryMember", map);
	}



	public int getMemberListCount(Map map) {
	    Object obj = queryForObject("getMemberListCount", map);
        return obj==null?0:((Integer)obj).intValue();
    }


    public void insertMember(Member member) {
        insert("insertMember", member);
    }



    public void updateMember(Member member) {
        update("updateMember", member);
    }

    

	public void deleteMember(Map map) {
	    delete("deleteMember", map);
    }



    public List getRole(Map map) {
		return queryForList("getRole",map);
	}
    


	public void updateRole(Role role) throws Exception{
		try{
			update("updateRole", role);
		}catch(Exception e){
			throw new Exception();
		}
		
	}

		

	public void deleteRole(Map map) throws Exception {
		try{
			delete("deleteRole", map);
		}catch(Exception e){
			throw new Exception();
		}
	}



	public void insertRole(Role role) throws Exception {
		try{
			insert("insertRole", role);
		}catch(Exception e){
			e.printStackTrace();
			throw new Exception();
		}
	}



	public List getContacts(Map map) {
		return queryForList("getContacts",map);
	}



	public void deleteMemberRole(Map map) throws Exception {
		try{
			delete("deleteMemberRole", map);
		}catch(Exception e){
			e.printStackTrace();
			throw new Exception();
		}
	}



	public void insertMemberRole(Map map) throws Exception {
		try{
			insert("insertMemberRole", map);
		}catch(Exception e){
			e.printStackTrace();
			throw new Exception();
		}
	}
	

	
    
    
	
	
	
}
